<?php
namespace app\mobile\controller;
use think\Controller;
use think\Request;
use think\Db;
class  Base extends  Controller{

    //构造器
    public function _initialize(){
         if(!isMobile()){
           exit($this->redirect(urlProtocol()));
         }
        $request    = Request::instance();//获取请求类型
        $controller = $request->controller();//获取控制器
        $action     = $request->action();
        if($controller == 'Lawyer' && $action == 'detail'){
            $name       = $request->path();
        }else{
            $name       = $controller.'/'.$action;
        }
        $where['tkd_url'] = array('like',"%$name%");
        $where['type']    = 2;
        $data       = Db::name('tkd')->where($where)->cache(true,3600)->field('title,keywords,description')->find();
        $this->assign('data_tkd',$data);
    }
}
